package com.example.service;

import com.example.vo.BaseVo;
import com.example.vo.PageResult;
import org.springframework.data.domain.Sort;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * 由于mysql不支持异步，所以在此封装mysql的异步查询
 * @param <T>
 */
public interface BaseReactiveService<T> {

    <R> Flux<PageResult<R>> findAll(BaseVo queryVo);

    <R> Flux<PageResult<R>> findAllBySort(BaseVo queryVo, Sort sort);

    <S extends T, R> Mono<R> save(S var1);

    <S extends T, R> Flux<R> saveAll(Iterable<S> var1);

    <R> Mono<R> findById(String var1);

    Mono<Boolean> existsById(String var1);

    <R> Flux<R> findAll();

    <R> Flux<R> findAllById(Iterable<String> var1);

    Mono<Long> count();

    Mono<Void> deleteById(String var1);

    Mono<Void> delete(T var1);

    Mono<Void> deleteAll(Iterable<? extends T> var1);

    Mono<Void> deleteAll();
}
